const EnumPlatform = {
    Tencent: {
        code: 'Tencent',
        type: 1,
        label: '腾讯云'
    },
    AliYun: {
        code: 'AliYun',
        type: 2,
        label: '阿里云'
    },
    Baidu: {
        code: 'Baidu',
        type: 3,
        label: '百度云'
    },
    Huawei: {
        code: 'Huawei',
        type: 4,
        label: '华为云'
    },

    getByType(type) {
        const keys = Object.keys(this);
        for (let i = 0; i < keys.length; i++) {
            const key = keys[i]
            const value = this[key]
            if (value.type === parseInt(type)) {
                return value
            }
        }
        return null
    },

    valueList() {
        let list = []
        let values = Object.values(this)
        values.forEach(item => {
            if ((typeof item) === 'object') {
                list.push(item)
            }
        })
        return list
    }
}

export default EnumPlatform